\(\int (a+i a \tan (e+f x))^2 (c+d \tan (e+f x))^3 \, dx\) [1078]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 28, antiderivative size = 141 \[ \int (a+i a \tan (e+f x))^2 (c+d \tan (e+f x))^3 \, dx=2 a^2 (c-i d)^3 x+\frac {2 a^2 (i c+d)^3 \log (\cos (e+f x))}{f}+\frac {2 i a^2 (c-i d)^2 d \tan (e+f x)}{f}+\frac {a^2 (i c+d) (c+d \tan (e+f x))^2}{f}+\frac {2 i a^2 (c+d \tan (e+f x))^3}{3 f}-\frac {a^2 (c+d \tan (e+f x))^4}{4 d f} \]

[Out]

2*a^2*(c-I*d)^3*x+2*a^2*(I*c+d)^3*ln(cos(f*x+e))/f+2*I*a^2*(c-I*d)^2*d*tan(f*x+e)/f+a^2*(I*c+d)*(c+d*tan(f*x+e
))^2/f+2/3*I*a^2*(c+d*tan(f*x+e))^3/f-1/4*a^2*(c+d*tan(f*x+e))^4/d/f

Rubi [A] (verified)

Time = 0.23 (sec) , antiderivative size = 141, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.143, Rules used = {3624, 3609, 3606, 3556} \[ \int (a+i a \tan (e+f x))^2 (c+d \tan (e+f x))^3 \, dx=-\frac {a^2 (c+d \tan (e+f x))^4}{4 d f}+\frac {2 i a^2 (c+d \tan (e+f x))^3}{3 f}+\frac {a^2 (d+i c) (c+d \tan (e+f x))^2}{f}+\frac {2 i a^2 d (c-i d)^2 \tan (e+f x)}{f}+\frac {2 a^2 (d+i c)^3 \log (\cos (e+f x))}{f}+2 a^2 x (c-i d)^3 \]

[In]

Int[(a + I*a*Tan[e + f*x])^2*(c + d*Tan[e + f*x])^3,x]

[Out]

2*a^2*(c - I*d)^3*x + (2*a^2*(I*c + d)^3*Log[Cos[e + f*x]])/f + ((2*I)*a^2*(c - I*d)^2*d*Tan[e + f*x])/f + (a^
2*(I*c + d)*(c + d*Tan[e + f*x])^2)/f + (((2*I)/3)*a^2*(c + d*Tan[e + f*x])^3)/f - (a^2*(c + d*Tan[e + f*x])^4
)/(4*d*f)

Rule 3556

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3606

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(a*c - b
*d)*x, x] + (Dist[b*c + a*d, Int[Tan[e + f*x], x], x] + Simp[b*d*(Tan[e + f*x]/f), x]) /; FreeQ[{a, b, c, d, e
, f}, x] && NeQ[b*c - a*d, 0] && NeQ[b*c + a*d, 0]

Rule 3609

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[d*
((a + b*Tan[e + f*x])^m/(f*m)), x] + Int[(a + b*Tan[e + f*x])^(m - 1)*Simp[a*c - b*d + (b*c + a*d)*Tan[e + f*x
], x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && GtQ[m, 0]

Rule 3624

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^2, x_Symbol] :> Simp[
d^2*((a + b*Tan[e + f*x])^(m + 1)/(b*f*(m + 1))), x] + Int[(a + b*Tan[e + f*x])^m*Simp[c^2 - d^2 + 2*c*d*Tan[e
 + f*x], x], x] /; FreeQ[{a, b, c, d, e, f, m}, x] && NeQ[b*c - a*d, 0] &&  !LeQ[m, -1] &&  !(EqQ[m, 2] && EqQ
[a, 0])

Rubi steps \begin{align*} \text {integral}& = -\frac {a^2 (c+d \tan (e+f x))^4}{4 d f}+\int \left (2 a^2+2 i a^2 \tan (e+f x)\right ) (c+d \tan (e+f x))^3 \, dx \\ & = \frac {2 i a^2 (c+d \tan (e+f x))^3}{3 f}-\frac {a^2 (c+d \tan (e+f x))^4}{4 d f}+\int (c+d \tan (e+f x))^2 \left (2 a^2 (c-i d)+2 a^2 (i c+d) \tan (e+f x)\right ) \, dx \\ & = \frac {a^2 (i c+d) (c+d \tan (e+f x))^2}{f}+\frac {2 i a^2 (c+d \tan (e+f x))^3}{3 f}-\frac {a^2 (c+d \tan (e+f x))^4}{4 d f}+\int \left (2 a^2 (c-i d)^2+2 i a^2 (c-i d)^2 \tan (e+f x)\right ) (c+d \tan (e+f x)) \, dx \\ & = 2 a^2 (c-i d)^3 x+\frac {2 i a^2 (c-i d)^2 d \tan (e+f x)}{f}+\frac {a^2 (i c+d) (c+d \tan (e+f x))^2}{f}+\frac {2 i a^2 (c+d \tan (e+f x))^3}{3 f}-\frac {a^2 (c+d \tan (e+f x))^4}{4 d f}-\left (2 a^2 (i c+d)^3\right ) \int \tan (e+f x) \, dx \\ & = 2 a^2 (c-i d)^3 x+\frac {2 a^2 (i c+d)^3 \log (\cos (e+f x))}{f}+\frac {2 i a^2 (c-i d)^2 d \tan (e+f x)}{f}+\frac {a^2 (i c+d) (c+d \tan (e+f x))^2}{f}+\frac {2 i a^2 (c+d \tan (e+f x))^3}{3 f}-\frac {a^2 (c+d \tan (e+f x))^4}{4 d f} \\ \end{align*}

Mathematica [A] (verified)

Time = 4.58 (sec) , antiderivative size = 111, normalized size of antiderivative = 0.79 \[ \int (a+i a \tan (e+f x))^2 (c+d \tan (e+f x))^3 \, dx=\frac {a^2 \left (8 i (c-i d)^3 \log (i+\tan (e+f x))-8 i d (i c+d)^2 \tan (e+f x)+4 (i c+d) (c+d \tan (e+f x))^2+\frac {8}{3} i (c+d \tan (e+f x))^3-\frac {(c+d \tan (e+f x))^4}{d}\right )}{4 f} \]

[In]

Integrate[(a + I*a*Tan[e + f*x])^2*(c + d*Tan[e + f*x])^3,x]

[Out]

(a^2*((8*I)*(c - I*d)^3*Log[I + Tan[e + f*x]] - (8*I)*d*(I*c + d)^2*Tan[e + f*x] + 4*(I*c + d)*(c + d*Tan[e +
f*x])^2 + ((8*I)/3)*(c + d*Tan[e + f*x])^3 - (c + d*Tan[e + f*x])^4/d))/(4*f)

Maple [A] (verified)

Time = 0.33 (sec) , antiderivative size = 210, normalized size of antiderivative = 1.49

method result size
derivativedivides \(\frac {a^{2} \left (\frac {2 i d^{3} \left (\tan ^{3}\left (f x +e \right )\right )}{3}-\frac {d^{3} \left (\tan ^{4}\left (f x +e \right )\right )}{4}+3 i c \,d^{2} \left (\tan ^{2}\left (f x +e \right )\right )-c \,d^{2} \left (\tan ^{3}\left (f x +e \right )\right )+6 i c^{2} d \tan \left (f x +e \right )-2 i d^{3} \tan \left (f x +e \right )-\frac {3 c^{2} d \left (\tan ^{2}\left (f x +e \right )\right )}{2}+d^{3} \left (\tan ^{2}\left (f x +e \right )\right )-c^{3} \tan \left (f x +e \right )+6 c \,d^{2} \tan \left (f x +e \right )+\frac {\left (2 i c^{3}-6 i c \,d^{2}+6 c^{2} d -2 d^{3}\right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (-6 i c^{2} d +2 i d^{3}+2 c^{3}-6 c \,d^{2}\right ) \arctan \left (\tan \left (f x +e \right )\right )\right )}{f}\) \(210\)
default \(\frac {a^{2} \left (\frac {2 i d^{3} \left (\tan ^{3}\left (f x +e \right )\right )}{3}-\frac {d^{3} \left (\tan ^{4}\left (f x +e \right )\right )}{4}+3 i c \,d^{2} \left (\tan ^{2}\left (f x +e \right )\right )-c \,d^{2} \left (\tan ^{3}\left (f x +e \right )\right )+6 i c^{2} d \tan \left (f x +e \right )-2 i d^{3} \tan \left (f x +e \right )-\frac {3 c^{2} d \left (\tan ^{2}\left (f x +e \right )\right )}{2}+d^{3} \left (\tan ^{2}\left (f x +e \right )\right )-c^{3} \tan \left (f x +e \right )+6 c \,d^{2} \tan \left (f x +e \right )+\frac {\left (2 i c^{3}-6 i c \,d^{2}+6 c^{2} d -2 d^{3}\right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (-6 i c^{2} d +2 i d^{3}+2 c^{3}-6 c \,d^{2}\right ) \arctan \left (\tan \left (f x +e \right )\right )\right )}{f}\) \(210\)
norman \(\left (-6 i a^{2} c^{2} d +2 i a^{2} d^{3}+2 a^{2} c^{3}-6 a^{2} c \,d^{2}\right ) x -\frac {\left (-2 i a^{2} d^{3}+3 a^{2} c \,d^{2}\right ) \left (\tan ^{3}\left (f x +e \right )\right )}{3 f}+\frac {\left (6 i a^{2} c \,d^{2}-3 a^{2} c^{2} d +2 a^{2} d^{3}\right ) \left (\tan ^{2}\left (f x +e \right )\right )}{2 f}-\frac {\left (-6 i a^{2} c^{2} d +2 i a^{2} d^{3}+a^{2} c^{3}-6 a^{2} c \,d^{2}\right ) \tan \left (f x +e \right )}{f}-\frac {a^{2} d^{3} \left (\tan ^{4}\left (f x +e \right )\right )}{4 f}-\frac {\left (-i a^{2} c^{3}+3 i a^{2} c \,d^{2}-3 a^{2} c^{2} d +a^{2} d^{3}\right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{f}\) \(232\)
parts \(a^{2} c^{3} x +\frac {\left (2 i a^{2} c^{3}+3 a^{2} c^{2} d \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2 f}+\frac {\left (2 i a^{2} d^{3}-3 a^{2} c \,d^{2}\right ) \left (\frac {\left (\tan ^{3}\left (f x +e \right )\right )}{3}-\tan \left (f x +e \right )+\arctan \left (\tan \left (f x +e \right )\right )\right )}{f}+\frac {\left (6 i a^{2} c \,d^{2}-3 a^{2} c^{2} d +a^{2} d^{3}\right ) \left (\frac {\left (\tan ^{2}\left (f x +e \right )\right )}{2}-\frac {\ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}\right )}{f}+\frac {\left (6 i a^{2} c^{2} d -a^{2} c^{3}+3 a^{2} c \,d^{2}\right ) \left (\tan \left (f x +e \right )-\arctan \left (\tan \left (f x +e \right )\right )\right )}{f}-\frac {a^{2} d^{3} \left (\frac {\left (\tan ^{4}\left (f x +e \right )\right )}{4}-\frac {\left (\tan ^{2}\left (f x +e \right )\right )}{2}+\frac {\ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}\right )}{f}\) \(242\)
parallelrisch \(\frac {8 i \left (\tan ^{3}\left (f x +e \right )\right ) a^{2} d^{3}-3 a^{2} d^{3} \left (\tan ^{4}\left (f x +e \right )\right )-24 i \tan \left (f x +e \right ) a^{2} d^{3}+72 i \tan \left (f x +e \right ) a^{2} c^{2} d +12 i \ln \left (1+\tan ^{2}\left (f x +e \right )\right ) a^{2} c^{3}-12 \left (\tan ^{3}\left (f x +e \right )\right ) a^{2} c \,d^{2}-72 i x \,a^{2} c^{2} d f -36 i \ln \left (1+\tan ^{2}\left (f x +e \right )\right ) a^{2} c \,d^{2}+36 i \left (\tan ^{2}\left (f x +e \right )\right ) a^{2} c \,d^{2}+24 i x \,a^{2} d^{3} f +24 x \,a^{2} c^{3} f -72 x \,a^{2} c \,d^{2} f -18 \left (\tan ^{2}\left (f x +e \right )\right ) a^{2} c^{2} d +12 \left (\tan ^{2}\left (f x +e \right )\right ) a^{2} d^{3}+36 \ln \left (1+\tan ^{2}\left (f x +e \right )\right ) a^{2} c^{2} d -12 \ln \left (1+\tan ^{2}\left (f x +e \right )\right ) a^{2} d^{3}-12 \tan \left (f x +e \right ) a^{2} c^{3}+72 \tan \left (f x +e \right ) a^{2} c \,d^{2}}{12 f}\) \(292\)
risch \(-\frac {2 i a^{2} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) c^{3}}{f}-\frac {4 i a^{2} d^{3} e}{f}+\frac {6 i a^{2} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) c \,d^{2}}{f}+\frac {12 i a^{2} c^{2} d e}{f}-\frac {4 a^{2} c^{3} e}{f}+\frac {12 a^{2} c \,d^{2} e}{f}+\frac {2 a^{2} \left (99 i c \,d^{2} {\mathrm e}^{4 i \left (f x +e \right )}+45 i c \,d^{2} {\mathrm e}^{6 i \left (f x +e \right )}-27 c^{2} d \,{\mathrm e}^{6 i \left (f x +e \right )}+21 d^{3} {\mathrm e}^{6 i \left (f x +e \right )}-9 i c^{3} {\mathrm e}^{4 i \left (f x +e \right )}-3 i c^{3} {\mathrm e}^{6 i \left (f x +e \right )}-72 c^{2} d \,{\mathrm e}^{4 i \left (f x +e \right )}+36 d^{3} {\mathrm e}^{4 i \left (f x +e \right )}-9 i c^{3} {\mathrm e}^{2 i \left (f x +e \right )}+75 i c \,d^{2} {\mathrm e}^{2 i \left (f x +e \right )}-63 c^{2} d \,{\mathrm e}^{2 i \left (f x +e \right )}+29 d^{3} {\mathrm e}^{2 i \left (f x +e \right )}+21 i c \,d^{2}-3 i c^{3}-18 c^{2} d +8 d^{3}\right )}{3 f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )^{4}}-\frac {6 a^{2} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) c^{2} d}{f}+\frac {2 a^{2} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) d^{3}}{f}\) \(376\)

[In]

int((a+I*a*tan(f*x+e))^2*(c+d*tan(f*x+e))^3,x,method=_RETURNVERBOSE)

[Out]

1/f*a^2*(2/3*I*d^3*tan(f*x+e)^3-1/4*d^3*tan(f*x+e)^4+3*I*c*d^2*tan(f*x+e)^2-c*d^2*tan(f*x+e)^3+6*I*c^2*d*tan(f
*x+e)-2*I*d^3*tan(f*x+e)-3/2*c^2*d*tan(f*x+e)^2+d^3*tan(f*x+e)^2-c^3*tan(f*x+e)+6*c*d^2*tan(f*x+e)+1/2*(-2*d^3
+6*c^2*d-6*I*c*d^2+2*I*c^3)*ln(1+tan(f*x+e)^2)+(-6*c*d^2+2*I*d^3+2*c^3-6*I*c^2*d)*arctan(tan(f*x+e)))

Fricas [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 457 vs. \(2 (125) = 250\).

Time = 0.25 (sec) , antiderivative size = 457, normalized size of antiderivative = 3.24 \[ \int (a+i a \tan (e+f x))^2 (c+d \tan (e+f x))^3 \, dx=-\frac {2 \, {\left (3 i \, a^{2} c^{3} + 18 \, a^{2} c^{2} d - 21 i \, a^{2} c d^{2} - 8 \, a^{2} d^{3} + 3 \, {\left (i \, a^{2} c^{3} + 9 \, a^{2} c^{2} d - 15 i \, a^{2} c d^{2} - 7 \, a^{2} d^{3}\right )} e^{\left (6 i \, f x + 6 i \, e\right )} + 9 \, {\left (i \, a^{2} c^{3} + 8 \, a^{2} c^{2} d - 11 i \, a^{2} c d^{2} - 4 \, a^{2} d^{3}\right )} e^{\left (4 i \, f x + 4 i \, e\right )} + {\left (9 i \, a^{2} c^{3} + 63 \, a^{2} c^{2} d - 75 i \, a^{2} c d^{2} - 29 \, a^{2} d^{3}\right )} e^{\left (2 i \, f x + 2 i \, e\right )} + 3 \, {\left (i \, a^{2} c^{3} + 3 \, a^{2} c^{2} d - 3 i \, a^{2} c d^{2} - a^{2} d^{3} + {\left (i \, a^{2} c^{3} + 3 \, a^{2} c^{2} d - 3 i \, a^{2} c d^{2} - a^{2} d^{3}\right )} e^{\left (8 i \, f x + 8 i \, e\right )} + 4 \, {\left (i \, a^{2} c^{3} + 3 \, a^{2} c^{2} d - 3 i \, a^{2} c d^{2} - a^{2} d^{3}\right )} e^{\left (6 i \, f x + 6 i \, e\right )} + 6 \, {\left (i \, a^{2} c^{3} + 3 \, a^{2} c^{2} d - 3 i \, a^{2} c d^{2} - a^{2} d^{3}\right )} e^{\left (4 i \, f x + 4 i \, e\right )} + 4 \, {\left (i \, a^{2} c^{3} + 3 \, a^{2} c^{2} d - 3 i \, a^{2} c d^{2} - a^{2} d^{3}\right )} e^{\left (2 i \, f x + 2 i \, e\right )}\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right )\right )}}{3 \, {\left (f e^{\left (8 i \, f x + 8 i \, e\right )} + 4 \, f e^{\left (6 i \, f x + 6 i \, e\right )} + 6 \, f e^{\left (4 i \, f x + 4 i \, e\right )} + 4 \, f e^{\left (2 i \, f x + 2 i \, e\right )} + f\right )}} \]

[In]

integrate((a+I*a*tan(f*x+e))^2*(c+d*tan(f*x+e))^3,x, algorithm="fricas")

[Out]

-2/3*(3*I*a^2*c^3 + 18*a^2*c^2*d - 21*I*a^2*c*d^2 - 8*a^2*d^3 + 3*(I*a^2*c^3 + 9*a^2*c^2*d - 15*I*a^2*c*d^2 -
7*a^2*d^3)*e^(6*I*f*x + 6*I*e) + 9*(I*a^2*c^3 + 8*a^2*c^2*d - 11*I*a^2*c*d^2 - 4*a^2*d^3)*e^(4*I*f*x + 4*I*e)
+ (9*I*a^2*c^3 + 63*a^2*c^2*d - 75*I*a^2*c*d^2 - 29*a^2*d^3)*e^(2*I*f*x + 2*I*e) + 3*(I*a^2*c^3 + 3*a^2*c^2*d
- 3*I*a^2*c*d^2 - a^2*d^3 + (I*a^2*c^3 + 3*a^2*c^2*d - 3*I*a^2*c*d^2 - a^2*d^3)*e^(8*I*f*x + 8*I*e) + 4*(I*a^2
*c^3 + 3*a^2*c^2*d - 3*I*a^2*c*d^2 - a^2*d^3)*e^(6*I*f*x + 6*I*e) + 6*(I*a^2*c^3 + 3*a^2*c^2*d - 3*I*a^2*c*d^2
 - a^2*d^3)*e^(4*I*f*x + 4*I*e) + 4*(I*a^2*c^3 + 3*a^2*c^2*d - 3*I*a^2*c*d^2 - a^2*d^3)*e^(2*I*f*x + 2*I*e))*l
og(e^(2*I*f*x + 2*I*e) + 1))/(f*e^(8*I*f*x + 8*I*e) + 4*f*e^(6*I*f*x + 6*I*e) + 6*f*e^(4*I*f*x + 4*I*e) + 4*f*
e^(2*I*f*x + 2*I*e) + f)

Sympy [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 381 vs. \(2 (122) = 244\).

Time = 0.62 (sec) , antiderivative size = 381, normalized size of antiderivative = 2.70 \[ \int (a+i a \tan (e+f x))^2 (c+d \tan (e+f x))^3 \, dx=- \frac {2 i a^{2} \left (c - i d\right )^{3} \log {\left (e^{2 i f x} + e^{- 2 i e} \right )}}{f} + \frac {- 6 i a^{2} c^{3} - 36 a^{2} c^{2} d + 42 i a^{2} c d^{2} + 16 a^{2} d^{3} + \left (- 18 i a^{2} c^{3} e^{2 i e} - 126 a^{2} c^{2} d e^{2 i e} + 150 i a^{2} c d^{2} e^{2 i e} + 58 a^{2} d^{3} e^{2 i e}\right ) e^{2 i f x} + \left (- 18 i a^{2} c^{3} e^{4 i e} - 144 a^{2} c^{2} d e^{4 i e} + 198 i a^{2} c d^{2} e^{4 i e} + 72 a^{2} d^{3} e^{4 i e}\right ) e^{4 i f x} + \left (- 6 i a^{2} c^{3} e^{6 i e} - 54 a^{2} c^{2} d e^{6 i e} + 90 i a^{2} c d^{2} e^{6 i e} + 42 a^{2} d^{3} e^{6 i e}\right ) e^{6 i f x}}{3 f e^{8 i e} e^{8 i f x} + 12 f e^{6 i e} e^{6 i f x} + 18 f e^{4 i e} e^{4 i f x} + 12 f e^{2 i e} e^{2 i f x} + 3 f} \]

[In]

integrate((a+I*a*tan(f*x+e))**2*(c+d*tan(f*x+e))**3,x)

[Out]

-2*I*a**2*(c - I*d)**3*log(exp(2*I*f*x) + exp(-2*I*e))/f + (-6*I*a**2*c**3 - 36*a**2*c**2*d + 42*I*a**2*c*d**2
 + 16*a**2*d**3 + (-18*I*a**2*c**3*exp(2*I*e) - 126*a**2*c**2*d*exp(2*I*e) + 150*I*a**2*c*d**2*exp(2*I*e) + 58
*a**2*d**3*exp(2*I*e))*exp(2*I*f*x) + (-18*I*a**2*c**3*exp(4*I*e) - 144*a**2*c**2*d*exp(4*I*e) + 198*I*a**2*c*
d**2*exp(4*I*e) + 72*a**2*d**3*exp(4*I*e))*exp(4*I*f*x) + (-6*I*a**2*c**3*exp(6*I*e) - 54*a**2*c**2*d*exp(6*I*
e) + 90*I*a**2*c*d**2*exp(6*I*e) + 42*a**2*d**3*exp(6*I*e))*exp(6*I*f*x))/(3*f*exp(8*I*e)*exp(8*I*f*x) + 12*f*
exp(6*I*e)*exp(6*I*f*x) + 18*f*exp(4*I*e)*exp(4*I*f*x) + 12*f*exp(2*I*e)*exp(2*I*f*x) + 3*f)

Maxima [A] (verification not implemented)

none

Time = 0.32 (sec) , antiderivative size = 218, normalized size of antiderivative = 1.55 \[ \int (a+i a \tan (e+f x))^2 (c+d \tan (e+f x))^3 \, dx=-\frac {3 \, a^{2} d^{3} \tan \left (f x + e\right )^{4} + 4 \, {\left (3 \, a^{2} c d^{2} - 2 i \, a^{2} d^{3}\right )} \tan \left (f x + e\right )^{3} + 6 \, {\left (3 \, a^{2} c^{2} d - 6 i \, a^{2} c d^{2} - 2 \, a^{2} d^{3}\right )} \tan \left (f x + e\right )^{2} - 24 \, {\left (a^{2} c^{3} - 3 i \, a^{2} c^{2} d - 3 \, a^{2} c d^{2} + i \, a^{2} d^{3}\right )} {\left (f x + e\right )} - 12 \, {\left (i \, a^{2} c^{3} + 3 \, a^{2} c^{2} d - 3 i \, a^{2} c d^{2} - a^{2} d^{3}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right ) + 12 \, {\left (a^{2} c^{3} - 6 i \, a^{2} c^{2} d - 6 \, a^{2} c d^{2} + 2 i \, a^{2} d^{3}\right )} \tan \left (f x + e\right )}{12 \, f} \]

[In]

integrate((a+I*a*tan(f*x+e))^2*(c+d*tan(f*x+e))^3,x, algorithm="maxima")

[Out]

-1/12*(3*a^2*d^3*tan(f*x + e)^4 + 4*(3*a^2*c*d^2 - 2*I*a^2*d^3)*tan(f*x + e)^3 + 6*(3*a^2*c^2*d - 6*I*a^2*c*d^
2 - 2*a^2*d^3)*tan(f*x + e)^2 - 24*(a^2*c^3 - 3*I*a^2*c^2*d - 3*a^2*c*d^2 + I*a^2*d^3)*(f*x + e) - 12*(I*a^2*c
^3 + 3*a^2*c^2*d - 3*I*a^2*c*d^2 - a^2*d^3)*log(tan(f*x + e)^2 + 1) + 12*(a^2*c^3 - 6*I*a^2*c^2*d - 6*a^2*c*d^
2 + 2*I*a^2*d^3)*tan(f*x + e))/f

Giac [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 852 vs. \(2 (125) = 250\).

Time = 0.87 (sec) , antiderivative size = 852, normalized size of antiderivative = 6.04 \[ \int (a+i a \tan (e+f x))^2 (c+d \tan (e+f x))^3 \, dx=\text {Too large to display} \]

[In]

integrate((a+I*a*tan(f*x+e))^2*(c+d*tan(f*x+e))^3,x, algorithm="giac")

[Out]

-2/3*(3*I*a^2*c^3*e^(8*I*f*x + 8*I*e)*log(e^(2*I*f*x + 2*I*e) + 1) + 9*a^2*c^2*d*e^(8*I*f*x + 8*I*e)*log(e^(2*
I*f*x + 2*I*e) + 1) - 9*I*a^2*c*d^2*e^(8*I*f*x + 8*I*e)*log(e^(2*I*f*x + 2*I*e) + 1) - 3*a^2*d^3*e^(8*I*f*x +
8*I*e)*log(e^(2*I*f*x + 2*I*e) + 1) + 12*I*a^2*c^3*e^(6*I*f*x + 6*I*e)*log(e^(2*I*f*x + 2*I*e) + 1) + 36*a^2*c
^2*d*e^(6*I*f*x + 6*I*e)*log(e^(2*I*f*x + 2*I*e) + 1) - 36*I*a^2*c*d^2*e^(6*I*f*x + 6*I*e)*log(e^(2*I*f*x + 2*
I*e) + 1) - 12*a^2*d^3*e^(6*I*f*x + 6*I*e)*log(e^(2*I*f*x + 2*I*e) + 1) + 18*I*a^2*c^3*e^(4*I*f*x + 4*I*e)*log
(e^(2*I*f*x + 2*I*e) + 1) + 54*a^2*c^2*d*e^(4*I*f*x + 4*I*e)*log(e^(2*I*f*x + 2*I*e) + 1) - 54*I*a^2*c*d^2*e^(
4*I*f*x + 4*I*e)*log(e^(2*I*f*x + 2*I*e) + 1) - 18*a^2*d^3*e^(4*I*f*x + 4*I*e)*log(e^(2*I*f*x + 2*I*e) + 1) +
12*I*a^2*c^3*e^(2*I*f*x + 2*I*e)*log(e^(2*I*f*x + 2*I*e) + 1) + 36*a^2*c^2*d*e^(2*I*f*x + 2*I*e)*log(e^(2*I*f*
x + 2*I*e) + 1) - 36*I*a^2*c*d^2*e^(2*I*f*x + 2*I*e)*log(e^(2*I*f*x + 2*I*e) + 1) - 12*a^2*d^3*e^(2*I*f*x + 2*
I*e)*log(e^(2*I*f*x + 2*I*e) + 1) + 3*I*a^2*c^3*e^(6*I*f*x + 6*I*e) + 27*a^2*c^2*d*e^(6*I*f*x + 6*I*e) - 45*I*
a^2*c*d^2*e^(6*I*f*x + 6*I*e) - 21*a^2*d^3*e^(6*I*f*x + 6*I*e) + 9*I*a^2*c^3*e^(4*I*f*x + 4*I*e) + 72*a^2*c^2*
d*e^(4*I*f*x + 4*I*e) - 99*I*a^2*c*d^2*e^(4*I*f*x + 4*I*e) - 36*a^2*d^3*e^(4*I*f*x + 4*I*e) + 9*I*a^2*c^3*e^(2
*I*f*x + 2*I*e) + 63*a^2*c^2*d*e^(2*I*f*x + 2*I*e) - 75*I*a^2*c*d^2*e^(2*I*f*x + 2*I*e) - 29*a^2*d^3*e^(2*I*f*
x + 2*I*e) + 3*I*a^2*c^3*log(e^(2*I*f*x + 2*I*e) + 1) + 9*a^2*c^2*d*log(e^(2*I*f*x + 2*I*e) + 1) - 9*I*a^2*c*d
^2*log(e^(2*I*f*x + 2*I*e) + 1) - 3*a^2*d^3*log(e^(2*I*f*x + 2*I*e) + 1) + 3*I*a^2*c^3 + 18*a^2*c^2*d - 21*I*a
^2*c*d^2 - 8*a^2*d^3)/(f*e^(8*I*f*x + 8*I*e) + 4*f*e^(6*I*f*x + 6*I*e) + 6*f*e^(4*I*f*x + 4*I*e) + 4*f*e^(2*I*
f*x + 2*I*e) + f)

Mupad [B] (verification not implemented)

Time = 6.27 (sec) , antiderivative size = 223, normalized size of antiderivative = 1.58 \[ \int (a+i a \tan (e+f x))^2 (c+d \tan (e+f x))^3 \, dx=\frac {{\mathrm {tan}\left (e+f\,x\right )}^2\,\left (\frac {a^2\,d^3}{2}+\frac {a^2\,d^2\,\left (d+c\,3{}\mathrm {i}\right )}{2}+\frac {a^2\,c\,d\,\left (d+c\,1{}\mathrm {i}\right )\,3{}\mathrm {i}}{2}\right )}{f}+\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )\,\left (a^2\,c^3\,2{}\mathrm {i}+6\,a^2\,c^2\,d-a^2\,c\,d^2\,6{}\mathrm {i}-2\,a^2\,d^3\right )}{f}-\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (a^2\,d^3\,1{}\mathrm {i}+a^2\,d^2\,\left (d+c\,3{}\mathrm {i}\right )\,1{}\mathrm {i}-a^2\,c^2\,\left (3\,d+c\,1{}\mathrm {i}\right )\,1{}\mathrm {i}-3\,a^2\,c\,d\,\left (d+c\,1{}\mathrm {i}\right )\right )}{f}+\frac {{\mathrm {tan}\left (e+f\,x\right )}^3\,\left (\frac {a^2\,d^3\,1{}\mathrm {i}}{3}+\frac {a^2\,d^2\,\left (d+c\,3{}\mathrm {i}\right )\,1{}\mathrm {i}}{3}\right )}{f}-\frac {a^2\,d^3\,{\mathrm {tan}\left (e+f\,x\right )}^4}{4\,f} \]

[In]

int((a + a*tan(e + f*x)*1i)^2*(c + d*tan(e + f*x))^3,x)

[Out]

(tan(e + f*x)^2*((a^2*d^3)/2 + (a^2*d^2*(c*3i + d))/2 + (a^2*c*d*(c*1i + d)*3i)/2))/f + (log(tan(e + f*x) + 1i
)*(a^2*c^3*2i - 2*a^2*d^3 - a^2*c*d^2*6i + 6*a^2*c^2*d))/f - (tan(e + f*x)*(a^2*d^3*1i + a^2*d^2*(c*3i + d)*1i
 - a^2*c^2*(c*1i + 3*d)*1i - 3*a^2*c*d*(c*1i + d)))/f + (tan(e + f*x)^3*((a^2*d^3*1i)/3 + (a^2*d^2*(c*3i + d)*
1i)/3))/f - (a^2*d^3*tan(e + f*x)^4)/(4*f)